<template>
        <Table border ref="selection" :columns="columns7" :data="data6"></Table>
</template>
<script>
    export default {
        data () {
            return {
                pageIndex: 1,
                pageSize: 10,
                searchvalue: '',
                columns7: [
                    {
                        type: 'selection',
                        width: 60,
                        align: 'center'
                    },
                    {
                        title: '标题',
                        key: 'title',
                        width: 350,
                        render: (h,params) => {
                            return h('div',{
                                style:{
                                    display: 'flex',
                                    fontSize:'14px',
                                    overflow:'hidden'
                                }
                            }, [
                                h('img', {
                                    attrs: {
                                        src: params.row.imgurl
                                    },
                                    style: {
                                        width: '80px',
                                        height: '80px',
                                        marginRight: '10px'
                                    }
                                }),
                                h('div', params.row.title, {
                                    style: {
                                        flex: 1
                                    }
                                })
                            ])
                        }
                    },
                    {
                        title: '类型',
                        key: 'categoryname'
                    },
                    {
                        title: '价格',
                        key: 'sell_price'
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.show(params.index)
                                        }
                                    }
                                }, '编辑'),
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data6: []
            }
        },
        methods: {
            show (index) {
                this.$Modal.info({
                    title: 'User Info',
                    content: `Name：${this.data6[index].name}<br>Age：${this.data6[index].age}<br>Address：${this.data6[index].address}`
                })
            },
            remove (index) {
                this.data6.splice(index, 1);
            }
        },

        mounted () {
            this.$axios({
                url: `/admin/goods/getlist`,
                params: {
                    pageIndex: this.pageIndex,
                    pageSize: this.pageSize,
                    searchvalue: this.searchvalue,
                }
            }).then(res => {
                // console.log(res);
                const {message} = res.data;
                console.log(message)

                this.data6 = message;
            })
        }
    }
</script>
 
 <style scoped>

 </style>
 